<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>数组map方法</title>
</head>

<body>
  <script>
    // map方法处理数组,返回一个新的数组
    const arr = ['张三', '李四', '王五']
    const newArray = arr.map(function (ele, index) {
      console.log(ele);   //拿到数组的元素
      console.log(index); //拿到数组的下标
      return ele + '好'
    })
    console.log(newArray);
  </script>
</body>

</html>